package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppMingxiFreetimeDao;
import com.vf.admin.client.dao.AppMingxiJinbiDao;
import com.vf.admin.client.dao.AppUserDao;
import com.vf.admin.client.service.AppMingxiFreetimeService;
import com.vf.admin.client.service.AppMingxiJinbiService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppMingxiFreetime;
import com.vf.admin.miaodong.entity.AppMingxiJinbi;
import com.vf.admin.miaodong.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class AppMingxiFreetimeServiceImpl implements AppMingxiFreetimeService {
    @Autowired
    private AppMingxiFreetimeDao appMingxiFreetimeDao;
    @Autowired
    private AppUserDao appUserDao;

    @Override
    public List<AppMingxiFreetime> findList(Integer userid, SplitPageBean splitPage) {
        return appMingxiFreetimeDao.findList(userid, splitPage);
    }

    @Override
    public AppMingxiFreetime get(Integer id) {
        return appMingxiFreetimeDao.get(id);
    }

    @Override
    public void save(AppMingxiFreetime haoYou) {
        appMingxiFreetimeDao.save(haoYou);
    }
    @Override
    public void addMingxi(Integer userid,Integer num,Integer leixing,String beizhu) {
        AppUser user=appUserDao.get(userid);
        AppMingxiFreetime zuanShi=new AppMingxiFreetime();
        zuanShi.setUserid(user.getId());
        zuanShi.setPic(user.getPic());
        zuanShi.setPhone(user.getLoginname());
        zuanShi.setNick(user.getNick());
        zuanShi.setLeixing(leixing);
        zuanShi.setNum(num);
        zuanShi.setCreatetime(new Date());
        zuanShi.setBeizhu(beizhu);
        appMingxiFreetimeDao.save(zuanShi);
    }

}
